RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-380242

Noname guy's questions

Martin Hope
Noname guy
Asked: 2022-08-03 22:28:11 +0000 UTC

为什么不能从 Carousel 中间连续删除元素?

  • 0

Carousel 显示了我需要添加/删除的对象集合,如果我从末尾或开头删除元素,那么我可以连续删除多个元素,但如果我从中间删除,那么结果是仅删除 1 个元素,据我了解,只有当我移动所选元素时轮播才会更新,我该如何解决这个问题?试过 Carousel.UpdateLayout() 但没有用:

页面.xaml:

        <controls:Carousel x:Name="ClipboardsCarousel"
                           Grid.Row="0"
                           Grid.RowSpan="2"
                           Margin="0,0,0,35"
                           ItemRotationX="0" ItemRotationY="35" ItemRotationZ="-5"
                           ItemsSource="{Binding Clipboards}"
                           InvertPositive="True" 
                           ItemDepth="250"
                           ItemMargin="25"
                           Orientation="Horizontal"
                           SelectedIndex="0">
            <controls:Carousel.EasingFunction>
                <CubicEase EasingMode="EaseInOut" />
            </controls:Carousel.EasingFunction>

            <controls:Carousel.ItemTemplate>
                <DataTemplate x:DataType="local:ClipboardModel">
                    <StackPanel Background="#1F1F1F" 
                                BorderThickness="1.8" 
                                BorderBrush="{StaticResource SystemAccentColor}"
                                CornerRadius="8"
                                Padding="15"
                                Width="250"
                                Height="350">
                        <TextBlock Text="{Binding Title}" 
                                   TextWrapping="Wrap"
                                   TextTrimming="CharacterEllipsis"
                                   TextAlignment="Center"
                                   FontSize="18"
                                   Margin="0,2,0,16"
                                   />
                        <TextBlock Text="{Binding Content}"
                                   MaxHeight="270"
                                   TextWrapping="Wrap"
                                   TextTrimming="CharacterEllipsis"
                                   Foreground="{StaticResource ShadedTextColor}"
                                   />
                    </StackPanel>
                </DataTemplate>
            </controls:Carousel.ItemTemplate>
        </controls:Carousel>

页面.xaml.cs:

        private void ConfirmDeleteButton_Click(object sender, RoutedEventArgs e)
        {
            int currentIndex = ClipboardsCarousel.SelectedIndex;
            viewModel.DeleteClipboard(((ClipboardModel)ClipboardsCarousel.SelectedItem).Title);


            if (ClipboardsCarousel.SelectedIndex == viewModel.Clipboards.Count)
            {
                ClipboardsCarousel.SelectedIndex -= 1;
            }
            else
            {
                ClipboardsCarousel.SelectedIndex = currentIndex;
            }

            ClipboardsCarousel.UpdateLayout();

        }

视图模型:

        public ObservableCollection<ClipboardModel> Clipboards { get; set; } = 
            new ObservableCollection<ClipboardModel>
        {
        };

        public void DeleteClipboard(string title)
        {
            ClipboardsDatabase.DeleteClipboard(title);
            RefreshClipboards();
        }
c# uwp
  • 2 个回答
  • 34 Views
Martin Hope
Noname guy
Asked: 2022-06-22 00:27:55 +0000 UTC

如何在 UWP 中更改活动/非活动窗口边框颜色?

  • 0

对焦和散焦时,Uwp 中的活动窗口有一个小边框,活动窗口为暗,非活动窗口为亮:

在此处输入图像描述

在此处输入图像描述

是否有可能以某种方式为两种状态设置颜色?

c#
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2022-06-14 02:51:09 +0000 UTC

如何在寻呼机中跟踪滑动(伴奏)

  • 0

我正在使用带有 ScrollableTabRow 的 Pager,并且由于 ScrollableTabRow 的选项卡离开屏幕,当 Pager 滑动时它的指示器也会离开屏幕,我如何跟踪到另一个页面的移动以导致选项卡本身翻转和其他一些逻辑?

在此处输入图像描述

    val selectedTabIndex = remember { mutableStateOf(currentDay) }
    val selectedTabTitle = remember { mutableStateOf(tabTitles[currentDay].title) }
    val pagerState = rememberPagerState(currentDay)

    //нужно вызвать этот метод
    fun selectTab(index: Int){
        selectedTabIndex.value = index
        selectedTabTitle.value = tabTitles[index].title
    }



                ScrollableTabRow(
                    modifier = Modifier
                        .padding(bottom = 10.dp, top = 15.dp),
                    contentColor = light_shaded,
                    selectedTabIndex = selectedTabIndex.value,
                    edgePadding = 0.dp,
                    indicator = { tabPositions ->
                        TabRowDefaults.Indicator(
                            Modifier.pagerTabIndicatorOffset(
                                pagerState,
                                tabPositions
                            )
                        )
                    },
                    ) {
                    tabTitles.forEachIndexed { index, s ->
                        Tab(
                            text = {
                                Text(
                                    text = s.title.uppercase(Locale.getDefault()),
                                    fontSize = 18.sp
                                )
                            },
                            selected = selectedTabIndex.value == index,
                            onClick = { selectTab(index) },
                            modifier = Modifier.height(50.dp),
                        )
                    }

                }


                //текст привязан к selectedTabTitle
                Text(
                    modifier = Modifier
                        .padding(top = 20.dp, start = 35.dp),
                    text =  "${selectedTabTitle.value}, " +
                            "${TimeManager.getWeekDates()[0][selectedTabIndex.value]} " +
                               TimeManager.getWeekDates()[1][selectedTabIndex.value].capitalize(),
                    fontSize = 23.sp,
                    color = primary_color,
                    maxLines = 1,
                )


                    
                    HorizontalPager(
                        modifier = Modifier
                            .wrapContentHeight()
                            .fillMaxWidth()
                            .padding(top = 70.dp),
                        count = tabTitles.size,
                        state = pagerState,
                        contentPadding = PaddingValues(start = 15.dp),
                        verticalAlignment = Alignment.Top,
                    ){ tabIndex ->
                        LazyColumn(
                            modifier = Modifier
                                .padding( end = 15.dp, )//start = 15.dp, top = 70.dp
                            ,
                        ){
                            items(
                                state.schedule[tabIndex]//tabIndex selectedTabIndex.value
                                    .filter { it.dayDate != viewModel.weekParity.oppositeShortName }
                            ){ subject ->
                                SubjectItem(subject)
                            }
                        }
                    }
kotlin
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2022-05-07 03:24:26 +0000 UTC

如何在 recyclerview 的最大滚动上更改渐变颜色?

  • 0

我需要更改 recyclerview 滚动到极限时出现的东西的颜色: 在此处输入图像描述

据我了解,应用程序中所有此类事物的颜色均ColorPrimary在主题中设置,如何为特定的回收站视图设置颜色?

android
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2022-05-03 02:44:43 +0000 UTC

如何将数组保存到 android.room 数据库?

  • 1

我有一个需要存储在房间数据库中的数据类:

@Entity(tableName = "day_data_table")
data class Day(var subjcts : Iterable<Subject>, var dayOfMonth : String) {
    @PrimaryKey(autoGenerate = true)

    @ColumnInfo(name = "day_date")
    var Date : String = dayOfMonth
        private set

    @ColumnInfo(name = "date_subjects")
    var Subjects : Iterable<Subject> = subjcts
        private set
}

问题是我需要提前存储一个包含不定数量元素的数组,我该怎么做呢?

android
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2022-04-18 22:42:37 +0000 UTC

如何垂直居中textview?

  • 0

我需要将 tview3 垂直居中:

在此处输入图像描述

如何在不使用 match_parent 高度的情况下做到这一点 布局中section的大小是由tview2的大小决定的?像这样尝试:

                <RelativeLayout
                    android:id="@+id/relative"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentLeft="true"
                        android:orientation="vertical"
                        android:layout_marginRight="80dp"
                        android:layout_marginEnd="80dp">

                        <TextView
                            android:id="@+id/tview1"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="10dp"
                            android:layout_marginLeft="10dp"
                            android:text="text"
                            android:textColor="@android:color/background_light"
                            android:textSize="24sp"
                            android:textStyle="bold" />

                        <TextView
                            android:id="@+id/tview2"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="10dp"
                            android:layout_marginLeft="10dp"
                            android:layout_marginBottom="10dp"
                            android:text="wdd dwdwwfwfwfwfwf efef grg rgrg rgrgrgrg rgrgrgrgr tjghfgvb dfgdfgserg"
                            android:textColor="@color/text_light"
                            android:textSize="22sp" />
                    </LinearLayout>

                    <TextView
                        android:id="@+id/tview3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="15dp"
                        android:text="1"
                        android:gravity="center_vertical"
                        android:textColor="@android:color/background_light"
                        android:textSize="28sp"
                        android:textStyle="bold"
                        android:layout_alignParentEnd="true"
                        android:layout_alignParentRight="true"/>
                </RelativeLayout>
android
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2021-12-28 02:22:15 +0000 UTC

是否可以不将元素放入数组生成器中的数组中?

  • 0

在 python 中创建数组生成器时,您可以使用条件运算符:
[i if i == x else None for i in arr]如果条件不满足,是否可以以某种方式跳过 else 块的执行并且不在输出数组中放置任何值?

python
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-10-01 02:41:27 +0000 UTC

如何在 discord.py 上处理 bot 命令中的类似错误

  • 0

有一个命令将需要清理的消息数量作为函数的参数,当传递错误类型的参数时,例如输入命令时,如何处理错误!clear @User?我试过这个,它不起作用:

@Bot.command(pass_context = True)
@commands.has_permissions(administrator = True)
async def clear(ctx, amount = 10):
    try:
        if amount <= 10:
            now = "Done"
        elif amount <= 50:
            now = "Thats all?"
        elif amount >= 90:
            now = "Big clear, buddy"
        elif amount >= 50:
            now = "Good cleaning"
        cln = discord.Embed(title = f'Messages cleared: {amount}. {now}', color= 0xFF3861)
        await ctx.channel.purge(limit = amount)
        await ctx.send(embed = cln)
    except:
        print("Do something")
python
  • 2 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-09-13 21:33:34 +0000 UTC

Lateinit 属性绑定未初始化错误

  • 0

我想将我的笔记应用程序Activity从Fragment. 一切Activity正常,但随着转移的开始,问题开始了。当您启动并选择一个片段时,应用程序崩溃并出现问题lateinit property binding has not been initialized,如何解决?

class PlannedEvFragment : Fragment(R.layout.fragment_planned_ev){
    private lateinit var binding: FragmentPlannedEvBinding
    private lateinit var noteViewModel: NoteViewModel
    private lateinit var adapter: NoteRecyclerViewAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val dao = NoteDatabase.getInstance(activity!!.application).noteDAO
        val repository = NoteRepository(dao)
        val factory = NoteViewModelFactory(repository)
        noteViewModel = ViewModelProvider(this, factory).get(NoteViewModel::class.java)

        binding.noteViewModel = noteViewModel    <-- на этой строчке выдает ошибку

        binding.lifecycleOwner = this
        displayNoteList()
        initRecyclerView()

        nnoteViewModel.message.observe(this, Observer {
            it.getContentIfNotHandled()?.let {
                Toast.makeText(activity!!.application, it, Toast.LENGTH_SHORT).show()
            }
        })
    }

    private fun initRecyclerView(){
        adapter = NoteRecyclerViewAdapter({ selectedItem: Note -> listItemClicked(selectedItem) })
        binding.noteRecyclerView.layoutManager = LinearLayoutManager(context)
        binding.noteRecyclerView.adapter = adapter
        displayNoteList()
    }

    private fun displayNoteList(){
        noteViewModel.notes.observe(this, Observer {
            Log.i("MYTAG", it.toString())
            adapter.setList(it)
            adapter.notifyDataSetChanged()
        })
    }
    private fun listItemClicked(note: Note){
        noteViewModel.initUpdateAndDelete(note)
    }
}

分段:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">
    <data>
        <variable
            name="noteViewModel"
            type="com.example.taskmanager.view.NoteViewModel" />

    </data>
android
  • 2 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-07-30 04:25:59 +0000 UTC

Kotlin 中的数组生成器?

  • 0

告诉我 Kotlin 中是否有类似 Python 的数组生成器:

a = [i.something for i in array]
python
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-07-26 23:06:23 +0000 UTC

如何在 kotlin 中创建 android.widget.Button 的子类

  • 0

我是 Kotlin 的新手。我需要创建一个类,它是一个子类,Button并且包含一个具有我想要的值的属性。我怎样才能正确地实现这一点?尝试过类似的东西:

    open class Button
    class cellButton() : Button()
    {
        var side = 0
    }
android
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-07-25 19:43:42 +0000 UTC

单击时如何更改按钮文本?科特林

  • 0

我有一个在单击按钮时触发的函数:

    fun cellPress(view: View) {

    }

如何在不使用的情况下更改按钮文本findViewById<>()?

像这样的东西:

    fun cellPress(view: View) {
        view.setText("text")
    }
android-studio
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-06-30 03:24:40 +0000 UTC

为 android 编译时出现 Kivy 错误

  • 0

我最近在kivy写了一个测试应用程序,我在编译的时候遇到了一个错误,谁能告诉我如何修复它?在virtualbox上编译,从官方github获取机器的存档。这是错误的文本:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/media/sf_Kivy_works/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
    main()
  File "/media/sf_Kivy_works/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/media/sf_Kivy_works/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
    getattr(self, command)(args)
  File "/media/sf_Kivy_works/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 151, in wrapper_func
    dist.delete()
  File "/media/sf_Kivy_works/.buildozer/android/platform/python-for-android/pythonforandroid/distribution.py", line 194, in delete
    rmtree(self.dist_dir)
  File "/usr/lib/python3.6/shutil.py", line 490, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib/python3.6/shutil.py", line 488, in rmtree
    os.rmdir(path)
OSError: [Errno 26] Text file busy: '/media/sf_Kivy_works/.buildozer/android/platform/build-armeabi-v7a/dists/TicTacToe__armeabi-v7a'
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=TicTacToe --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/media/sf_Kivy_works/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
# ENVIRONMENT:
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
#     LESSCLOSE = '/usr/bin/lesspipe %s %s'
#     XDG_MENU_PREFIX = 'xfce-'
#     LANG = 'en_ZA.UTF-8'
#     GDM_LANG = 'en_US'
#     DISPLAY = ':0.0'
#     GTK_OVERLAY_SCROLLING = '0'
#     COLORTERM = 'truecolor'
#     JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
#     XDG_VTNR = '7'
#     SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
#     VIRTUAL_ENV = '/home/kivy/kivy_venv'
#     MANDATORY_PATH = '/usr/share/gconf/xubuntu.mandatory.path'
#     GLADE_CATALOG_PATH = ':'
#     XDG_SESSION_ID = 'c1'
#     XDG_GREETER_DATA_DIR = '/var/lib/lightdm-data/kivy'
#     USER = 'kivy'
#     GLADE_MODULE_PATH = ':'
#     DESKTOP_SESSION = 'xubuntu'
#     DEFAULTS_PATH = '/usr/share/gconf/xubuntu.default.path'
#     QT_QPA_PLATFORMTHEME = 'gtk2'
#     PWD = '/media/sf_Kivy_works'
#     HOME = '/home/kivy'
#     SSH_AGENT_PID = '1247'
#     QT_ACCESSIBILITY = '1'
#     XDG_SESSION_TYPE = 'x11'
#     XDG_DATA_DIRS = '/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/var/lib/snapd/desktop:/usr/share'
#     XDG_SESSION_DESKTOP = 'xubuntu'
#     GLADE_PIXMAP_PATH = ':'
#     CLUTTER_BACKEND = 'x11'
#     SHELL = '/bin/bash'
#     VTE_VERSION = '5202'
#     TERM = 'xterm-256color'
#     XDG_SEAT_PATH = '/org/freedesktop/DisplayManager/Seat0'
#     XDG_CURRENT_DESKTOP = 'XFCE'
#     GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
#     XDG_SEAT = 'seat0'
#     SHLVL = '1'
#     LANGUAGE = 'en_ZA:en'
#     WINDOWID = '58720259'
#     GDMSESSION = 'xubuntu'
#     LOGNAME = 'kivy'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     XAUTHORITY = '/home/kivy/.Xauthority'
#     XDG_SESSION_PATH = '/org/freedesktop/DisplayManager/Session0'
#     XDG_CONFIG_DIRS = '/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg'
#     PATH = '/home/kivy/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/kivy/kivy_venv/bin:/bin:/home/kivy/bin:/home/kivy/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'
#     PS1 = ('(kivy_venv) \\[\\e]0;\\u@\\h: '
 '\\w\\a\\]${debian_chroot:+($debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ ')
#     SESSION_MANAGER = 'local/kivy-complete:@/tmp/.ICE-unix/1265,unix/kivy-complete:/tmp/.ICE-unix/1265'
#     LESSOPEN = '| /usr/bin/lesspipe %s'
#     _ = '/usr/local/bin/buildozer'
#     PACKAGES_PATH = '/home/kivy/.buildozer/android/packages'
#     ANDROIDSDK = '/home/kivy/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/kivy/.buildozer/android/platform/android-ndk-r19c'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '21'
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2


python
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-06-11 23:49:59 +0000 UTC

统一。如何引用嵌套在对象中的对象的组件?

  • 0

我有一个具有以下结构的游戏对象:

Player
    >BodyParts
    WeaponHolder
        >Gun1
        >Gun2
        >Gun3

如何在不使用公共 GameObject的情况下在 objectGun1的脚本中引用 object 的组件?Player

c#
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-05-30 20:21:21 +0000 UTC

WPF。如何引用另一个类的变量?

  • 0

有一个变量SelfPath值在变化。当您单击主窗口上的按钮时,会弹出一个辅助窗口CreateFileWindow,您需要在其文本框中显示值SelfPath。也许这是微不足道的,但我是 C# 新手,我该如何引用这个变量?

namespace CommandExecutor
{
    public partial class CreateFileWindow : Window
    {
        public string ViewModel { get; set; }
        public CreateFileWindow()
        {
            InitializeComponent();
        }
        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
        private void btnX_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        private void btnCreateFile_Click(object sender, RoutedEventArgs e)
        {
            FileDirTextBox.Text = "MainWindow.SelfPath ?";//здесь нужна переменная
        }
    }
    public partial class MainWindow : Window
    {
        Process CmdProcess = new Process();
        bool isWindowToggled = false;
        public string SelfPath = Environment.CurrentDirectory;//переменная
c#
  • 1 个回答
  • 10 Views
Martin Hope
Noname guy
Asked: 2020-03-31 20:08:03 +0000 UTC

在 Tkinter 中放置复选框的正确方法是什么?

  • 0

创建窗口时,复选框是在原始窗口上创建的,而不是在第二个窗口上创建的,并且其他小部件放置在所需的窗口上,我可以以某种方式修复它吗?

编码:

import tkinter as tk
from tkinter import Tk, ttk, END, Label, Button, Entry, Text, Checkbutton

class CreateWindow(ttk.Frame):
    def __init__(self, master):
        super().__init__()
        self.master = master

        self.start_button = Button(master, width=6, text="START", font="Consolas 10", bg="#22A5F1", fg="#fff", relief="flat",)
        self.start_button.pack()

        self.open_checkbox = Checkbutton(text="Открыть", onvalue=True, offvalue=False)
        self.open_checkbox.pack()

class MainWindow(ttk.Frame):
    def __init__(self, master):
        super().__init__()
        self.master = master

        self.create_button = Button(master, width=19, text="Create new", font="Consolas 10", bg="#191E2A", fg="#6EC7F4", relief="flat", command=self.create)
        self.create_button.pack()

    def create(self):
        root_create = tk.Toplevel()
        Frame = CreateWindow(root_create)

root = Tk()
Frame = MainWindow(root)
root.mainloop() 
python
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5